package com.xuxiang.cloud.controller;

import com.xuxiang.cloud.service.GreeterClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xuxiang 2019/5/30 22:02
 */
@RestController
public class GreeterController {

    @Autowired
    private GreeterClientService greeterClientService;

    @RequestMapping("/SayHello")
    public String SayHello(String name) {
        return greeterClientService.sayHello(name);
    }

    @RequestMapping("/test")
    public long test(String name) {

        long s = System.currentTimeMillis();
        for (int i = 0; i < 10000; i++) {
            greeterClientService.sayHello(name);
        }
        return System.currentTimeMillis() - s;
    }
}
